package com.advaita.gui;

import java.io.File;
import javax.swing.UIManager;

import com.advaita.license.Customer;
import com.advaita.license.License;
import com.advaita.util.*;

public class Advaita {
static Customer customer;
	public static void main(String[] args) {
		File l;

		String property = "swing.aatext";
		if (null == System.getProperty(property))
			System.setProperty(property, "true");

		// Set up the Nimbus look and feel
		UIManager.LookAndFeelInfo plafinfo[] = UIManager
				.getInstalledLookAndFeels();
		boolean nimbusfound = false;
		int nimbusindex = 0;

		for (int look = 0; look < plafinfo.length; look++) {
			if (plafinfo[look].getClassName().toLowerCase().contains("nimbus")) {
				nimbusfound = true;
				nimbusindex = look;
			}
		}

		try {

			if (nimbusfound) {
				UIManager.setLookAndFeel(plafinfo[nimbusindex].getClassName());
			} else

				UIManager.setLookAndFeel(UIManager
						.getCrossPlatformLookAndFeelClassName());

		} catch (Exception e) {
		}

		OsCheck osCheck = new OsCheck();
		switch (osCheck.getOperatingSystemType()) {
		// someone with windows needs to debug this.
		case Windows:
			l = new File("c:\\license.xml");
			break;
		case MacOS:
			// I'm assuming that you are going to install here??
			l = new File("/Library/Frameworks/Advaita/license.xml");
			break;
		case Linux:
			l = new File("/license.xml");
			System.out.println("need to do");
			break;
		default:
			l = new File("/license.xml");
			System.out.println("bad ops");
			break;
		}

		if (l.exists()) {
			customer = new Customer();
			// need to read the license key file
			// into licenseKey
			String licenseKey = "53217115116157196102106052315"; 
			customer = License.decodeSuperSecretCode(licenseKey);
			PathwayGuide pathwayguide = new PathwayGuide(customer);
		} else {
			GetLicenseOrRunTrial getLicense = new GetLicenseOrRunTrial();
		}

	}
}
